package com.zb.uniman.algorithmutils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Author:B
 * Description:
 */

public class algorithmutils {

    public static List sortBypop(List<Integer> list) {
//        集合转数组
//        int[] arr = BaseTransformer.toarr(list);
        int[] arr = new int[list.size()];
        for (int i=1;i<list.size();i++){
            arr[i] = list.get(i-1);
        }

        int n = arr.length;
        for (int i = 0; i < n - 1; i++) {
            for (int j = 0; j < n - i - 1; j++) {
                if (arr[j] > arr[j + 1]) {
                    int temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                }
            }
        }
//        数组转集合
//        List<Integer> list1 = BaseTransformer.fromarr(arr);
        ArrayList list1 = new ArrayList();
        for (int i=1;i< arr.length;i++){
            list1.add(arr[i]);
        }

        return list1;
    }

}
